﻿using System;
using System.Text;

namespace GPS.GPSLanguage
{
    class PDOPToken
    {
        internal static void ParseLanguage(GPSData gpsData, System.Collections.Queue q)
        {
            String valToken = (string)q.Dequeue();
            double val = 0;

            try
            {
                if (valToken.Length > 0)
                    val = double.Parse(valToken);
            }
            catch { }

            gpsData.SetDilutionOfPrecision(val);

            switch (gpsData.MessageType)
            {
                case MessageType.GPGSA:
                    HorizontalDilutionToken.ParseLanguage(gpsData, q);
                    break;
                default:
                    throw new InvalidLanguageException("How did you get here?");
            }
        }
    }
}
